<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>列表页面</title>
</head>
<body class="laytp-container">
<div id="search-form" style="display:none;">
    <div class="layui-layer-title">搜索</div>
    <form class="layui-form search-form-body" lay-filter="layui-form" style="margin-top:20px;">
        <div class="layui-form-item layui-inline">
                    <label class="layui-form-label" title="ID">ID</label>
                    <div class="layui-input-inline">
                        <input autocomplete="off" type="text" id="id" name="search_param[id][value]" placeholder="请输入ID" class="layui-input">
                        <input type="hidden" name="search_param[id][condition]" value="=">
                    </div>
                </div>

        <div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="手机号">手机号</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" type="text" id="phone" name="search_param[phone][value]" placeholder="请输入手机号" class="layui-input">
                    <input type="hidden" name="search_param[phone][condition]" value="LIKE">
                </div>
            </div>

			<div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="姓名">姓名</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" type="text" id="name" name="search_param[name][value]" placeholder="请输入姓名" class="layui-input">
                    <input type="hidden" name="search_param[name][condition]" value="LIKE">
                </div>
            </div>

			<div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="性别">性别</label>
                <div class="layui-input-inline">
                    <select id="sex" name="search_param[sex][value]">
                        <option value="">请选择性别</option>
        				<option value=""></option>
						<option value="1">男</option>
						<option value="0">女</option>
                    </select>
                    <input type="hidden" name="search_param[sex][condition]" value="=">
                </div>
            </div>

			<div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="身份">身份</label>
                <div class="layui-input-inline">
                    <select id="type" name="search_param[type][value]">
                        <option value="">请选择身份</option>
						<option value="1">Boss</option>
						<option value="2">Leader</option>
						<option value="3">Phper</option>
						<option value="4">Gofer</option>
                    </select>
                    <input type="hidden" name="search_param[type][condition]" value="=">
                </div>
            </div>

			<div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="身份证号码">身份证号码</label>
                <div class="layui-input-inline">
                    <input autocomplete="off" type="text" id="id_card" name="search_param[id_card][value]" placeholder="请输入身份证号码" class="layui-input">
                    <input type="hidden" name="search_param[id_card][condition]" value="LIKE">
                </div>
            </div>

			<div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="组织">组织</label>
                <div class="layui-input-inline">
                    <select id="org_id" name="search_param[org_id][value]">
                        <option value="">请选择组织</option>
                    </select>
                    <input type="hidden" name="search_param[org_id][condition]" value="=">
                </div>
            </div>

			<div class="layui-form-item layui-inline">
                <label class="layui-form-label" title="状态">状态</label>
                <div class="layui-input-inline">
                    <select id="status" name="search_param[status][value]">
                        <option value="">请选择状态</option>
        						<option value="0">封禁</option>
						<option value="1">正常</option>

                    </select>
                    <input type="hidden" name="search_param[status][condition]" value="=">
                </div>
            </div>

        <div class="bottom">
            <div class="button-container">
                <button class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="laytp-search-form">
                    <i class="layui-icon layui-icon-ok"></i>
                    提交
                </button>
                <button type="button" class="laytp-btn laytp-btn-sm laytp-search-form-reset">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </form>
</div>
<div class="layui-card">
    <div class="layui-card-body">
        <table id="laytp-table" lay-filter="laytp-table"></table>
    </div>
</div>

<script type="text/html" id="default-toolbar">
    {{# if(facade.hasAuth("/admin.students/edit") || facade.hasAuth("/admin.students/del")){ }}
    <div class="dropdown-menu">
        <button class="laytp-btn laytp-btn-primary laytp-btn-md">
            <i class="layui-icon layui-icon-triangle-d"></i>
            批量操作
        </button>
        <ul class="dropdown-menu-nav layui-anim-upbit dropdown-bottom-left layui-anim">
            <div class="dropdown-anchor"></div>
            {{# if(facade.hasAuth("/admin.students/edit")){ }}
            <li><a lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a></li>
            {{# } }}
            {{# if(facade.hasAuth("/admin.students/del")){ }}
            <li><a lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a></li>
            {{# } }}
        </ul>
    </div>
    {{# } }}
    {{# if(facade.hasAuth("/admin.students/add")){ }}
    <button class="laytp-btn laytp-btn-danger laytp-btn-md" lay-event="add">
        <i class="layui-icon layui-icon-add-1"></i>
        新增
    </button>
    {{# } }}
    <button class="laytp-btn laytp-btn-warming laytp-btn-md" lay-event="search">
        <i class="layui-icon layui-icon-search"></i>
        搜索
    </button>
    {{# if(facade.hasAuth("/admin.students/recycle")){ }}
    <button class="laytp-btn laytp-btn-success laytp-btn-md" lay-event="recycle">
        <i class="layui-icon layui-icon-delete"></i>
        回收站
    </button>
    {{# } }}
</script>

<script type="text/html" id="default-bar">
    {{# if(facade.hasAuth("/admin.students/edit")){ }}
    <button class="laytp-btn laytp-btn-primary laytp-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</button>
    {{# } }}
    {{# if(facade.hasAuth("/admin.students/del")){ }}
    <button class="laytp-btn laytp-btn-danger laytp-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</button>
    {{# } }}
</script>

<script>
    if(localStorage.getItem("staticDomain")){
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/laytp/css/laytp.css?v=" + Date.now() + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v=" + Date.now() + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v=" + Date.now() + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/admin/js/students.js?v=" + Date.now() + "'><\/script>");
    }else{
        document.write("<link rel='stylesheet' href='/static/component/laytp/css/laytp.css?v=" + Date.now() + "'>");
        document.write("<script src='/static/component/layui/layui.js?v=" + Date.now() + "'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v=" + Date.now() + "'><\/script>");
        document.write("<script src='/static/admin/js/students.js?v=" + Date.now() + "'><\/script>");
    }
</script>

<script>
    layui.use(['jquery', 'form'], function(){
        var $ = layui.$;
        var form = layui.form;

        // 获取组织列表
        $.ajax({
            url: '/admin.org/index',
            type: 'post',
            success: function(res){
                var orgSelect = $('select[name="search_param[org_id][value]"]');
                orgSelect.empty();
                orgSelect.append('<option value="">全部</option>');
                $.each(res.data, function(index, org){
                    orgSelect.append('<option value="' + org.id + '">' + org.name + '</option>');
                });
                form.render('select'); // 重新渲染下拉框
            }
        });
    });

</script>
</body>
</html>